using System.Collections.Generic;
using System.Linq;

namespace GameLogic.Poker
{
    public class CombinationGenerator : ICombinationGenerator
    {
        public IEnumerable<Hand> Generate(IEnumerable<Card> playerCards, IEnumerable<Card> desk)
        {
            var cards = playerCards.ToArray();
            var deskCards = desk.ToArray();

            yield return new Hand(deskCards[0], deskCards[1], deskCards[2], deskCards[3],deskCards[4]);
            yield return new Hand(cards[0], cards[1], deskCards[2], deskCards[3],deskCards[4]);
            yield return new Hand(cards[0], deskCards[1], deskCards[2], deskCards[3], deskCards[4]);
            yield return new Hand(deskCards[0], cards[0], deskCards[2], deskCards[3], deskCards[4]);
            yield return new Hand(deskCards[0], deskCards[1], cards[0], deskCards[3], deskCards[4]);
            yield return new Hand(deskCards[0], deskCards[1], deskCards[2], cards[0], deskCards[4]);
            yield return new Hand(deskCards[0], deskCards[1], deskCards[2], deskCards[3], cards[0]);
            yield return new Hand(deskCards[0], deskCards[1], deskCards[2], deskCards[3], cards[1]);
            yield return new Hand(deskCards[0], deskCards[1], deskCards[2], cards[1], deskCards[4]);
            yield return new Hand(deskCards[0], deskCards[1], cards[1], deskCards[3], deskCards[4]);
            yield return new Hand(deskCards[0], cards[1], deskCards[2], deskCards[3], deskCards[4]);
            yield return new Hand(cards[1], deskCards[1], deskCards[2], deskCards[3], deskCards[4]);
        }
    }
}